<template>
  <ul class="todo-list" >
    <!-- completed: 完成的类名 -->
    <li :class="{completed:obj.isDone}" v-for="obj in arr" :key="obj.id">
      <div class="view">
        <input class="toggle" type="checkbox" v-model="obj.isDone"/>
        <label>{{obj.name}}</label>


        <!-- 删除任务实现 -->
        <button class="destroy" @click="deleteFn(obj.id)"></button>
      </div>
    </li>
  </ul>
</template>

<script>
export default {
  name:"TodoMain",
  props: ["arr"],
  data () {
    return {
     
    }
  },
  methods:{
    deleteFn(id){
      this.$emit('deleteX',id)
    }
  }
}
</script>